package com.test.kotlin03

import java.io.File

fun runTest(){
    var file = File("/Users/lwb/AndroidStudioProjects/demo/KotlinDemo/kotlin01/src/main/java/com/test/kotlin03/i have a dream_copy.txt")
//    var file = File("./i have a dream_copy.txt")
    val result = file.run {
        readText().contains("great")
    }

    println(result)
}

fun isLong(name:String) = name.length >=10
fun showMessage(isLong:Boolean):String{
    return if(isLong){
        "Name is too long "
    }else{
        "Please rename "
    }
}

fun main(){
    runTest()

    val result:Boolean = "The people's Republic of China.".run (::isLong)
    println(result)

    "The people's Republic of China."
        .run (::isLong)
        .run (::showMessage)
        .run (::println)
}